package com.bocai.yuweiwangluo.utils;

import android.widget.ImageView;

import com.bocai.yuweiwangluo.R;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.assist.ImageScaleType;

/**
 * Created by admin on 2016/1/4.
 */
public class ImageLoaderUtil {
    public static void loaderImageDefault(String path, ImageView iv) {
        DisplayImageOptions options = new DisplayImageOptions.Builder()
                .showStubImage(R.mipmap.image_default)
                .showImageForEmptyUri(R.mipmap.image_default).cacheInMemory()
                .cacheOnDisc()
                .imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2)
                .build();
        ImageLoader.getInstance().displayImage(path, iv, options);
    }

    public static void loaderImage(String path, ImageView iv, int drawableid) {
        DisplayImageOptions options = new DisplayImageOptions.Builder()
                .showStubImage(drawableid).showImageForEmptyUri(drawableid)
                .cacheInMemory().cacheOnDisc()
                .imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2)
                .build();
        ImageLoader.getInstance().displayImage(path, iv, options);
    }
}
